import { wxRequest ,moduleGenerator} from '@/utils/request.js';
import { stringify } from 'qs';

const _actions = {
	operate({ commit }, params={}) {
		return new Promise((resolve, reject)=>{
			const {urlType,...param} = params;
			wxRequest(`uni/${urlType}`, param,'POST').then(res => {
				resolve(res);
			}).catch(reject)
		})
	},
	osUser({ commit }, params={}) {
		return new Promise((resolve, reject)=>{
			const {urlType,queryParam,method,...param} = params;
			const url = queryParam?`uni/${urlType}?${stringify(queryParam)}` : `uni/${urlType}`
			wxRequest(url, param,method).then(res => {
				resolve(res);
			}).catch(reject)
		})
	},
}

const {state,mutations,actions} = moduleGenerator('uni', [
	{action:'Config',method:'GET'}, 
	{action:'UserInfo',method:'GET'},
	{action:'ExistsUser',method:'POST'},
	{action:'CreateTruckTransport',method:'POST'},
	{action:'GetTruckList',method:'GET'},
	{action:'GetTruckTransport',method:'GET'},
	{action:'AddTruck',method:'POST'},
	{action:'ModifyTruck',method:'PUT'},
	{action:'DelTruck',method:'DELETE'},
	{action:'QueueSummaryList',method:'GET'},
	{action:'GetTruckTransport',method:'GET'},
	{action:'CancelBindGoods',method:'POST'},
	{action:'AddBindGoods',method:'POST'},
	{action:'GetTruckTransportList',method:'GET'},
	{action:'CancelTruckTransport',method:'DELETE'},
	{action:'GetQueueDetail',method:'POST'},
	{action:'UplLocation',method:'POST'},
	{action:'CancelQueue',method:'DELETE'},
	{action:'AddQueue',method:'POST'}, 
	{action:'GetDriverMessageList',method:'GET'}, 
	{action:'AddDriverMessage',method:'POST'}, 
	{action:'DELDriverMessage',method:'DELETE'}, 
	{action:'GetScanPierDate',method:'GET'}, 
	{action:'ScanPierQR',method:'GET'}, 
	{action:'GetFeedbackInfoList',method:'GET'}, 
	{action:'GetFeedbackInfo',method:'GET'}, 
	{action:'AddFeedback',method:'POST'}, 
	{action:'UploadFeedbackfile',method:'POST'}, 
	{action:'GetCZSignInfoList',method:'GET'}, 
	{action:'AddCZSign',method:'GET'},
	{action:'GetCurrentQueueUpInfo',method:'GET'},
	{action:'AddVehicleInformation',method:'POST'},
	{action:'GetVehicleInformationList',method:'GET'},
	{action:'GetVehicleInformationByVehicleNO',method:'GET'},
	
	{action:'ModifyVehicleInformation',method:'POST'},
	{action:'ScanAreaQR',method:'GET'},
	{action:'GetGateScanState',method:'GET'},
	
	
	
	
	])
export default {
	namespaced: true,
	state,
	mutations,
	actions:{...actions,..._actions}
};